home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / windows / pmcstex.zip / CSTEX_.E next >
Text File  |  1996-06-08  |  41KB  |  963 lines

  1. /**************************************************************************
  2.  This is CSTeX for EPM, version 8.6.1996 (but no change from 28.5.1996)
  3.  Written by Petr Mikulík, mikulik@physics.muni.cz
  4.      Address: Dept. of Solid State Physics, Masaryk University, 
  5.                Kotlarska 2, Brno, Czech Republic
  6.  Package location: http://www.sci.muni.cz/~mikulik/os2.html
  7.  
  8.  This macro file pmCSTeX.e (together with pm4epm.e) implements CSTeX menu 
  9.  for various (La)TeX related commands. 
  10.  
  11.  This package was intended to be the (final?) replacement for CSTeX, EPMTeX, 
  12.  TeXshell and pmgraf (and emacs perhaps?) under OS/2.  
  13.   *Must have* for TeX under OS/2 :-)
  14.  
  15.    Installation:
  16.  
  17.  1. Copy this file and pm4epm.e to any directory on your EPMPATH
  18.     (create directory E:\APPS\EPM\CSTeX, copy all files into it, modify
  19.      EPMPATH=...;E:\APPS\EPM\CSTeX;... in your CONFIG.SYS)
  20.  2. Write these lines into your Profile.erx:
  21.     'link pm4epm'
  22.     'link pmcstex'
  23.     'link czech'  -- this is for Czech users: Czech keyboard implementation by Z. Wagner     
  24.         'link sampactn' -- there is syntax highlighting there
  25.     'link MyCNF'  -- there are your actions there 
  26.  3. Add these two lines into  actions.lst  file:
  27.     CSTeX
  28.     pm4epm
  29.  4. Maybe something more, thus:
  30.  
  31.  5. *** Please read manual pmCSTeX.INF ***
  32.  
  33.  Compilation (of *.e to *.ex files): 
  34.  You must have received file  stdconst.e  from EPMMAC.ZIP  (it can be found 
  35.  on hobbes.nmsu.edu:os2/editors). Then type
  36.     etpm pm4epm
  37.     etpm cstex
  38.  
  39.   This package is free, but you can modify it only for your purposes and 
  40. you have to keep the original on a safe place. You must distribute this 
  41. package free of charge. If you make small changes here (you introduce a new 
  42. menu for your printer etc.), then keep the filename. Otherwise rename this 
  43. file. If you find bugs, or you find something missing, or you want to send 
  44. me your codes to put it in, you are welcome. 
  45.   Otherwise, if you think this package saves you $40, then send me $20, 
  46. so you gain $20! :-)) At least send me happy email if you happy using this
  47. package. 
  48.  
  49.  
  50. ***************************************************************************/
  51.  
  52. include 'stdconst.e'    -- from EPMMAC.ZIP
  53. -- include 'pm4epm.e'  -- Routines are used, but include not needed
  54.  
  55.  
  56. /*** define CSTeX hotkeys ***/
  57. def S_F11 = 'cstex_texit_background S'
  58. def S_F12 = 'cstex_next_error S'
  59.  
  60. DEFINIT
  61.   universal    pm4epm_MasterNotFound,
  62.         cstex_error_array_id, cstex_error_index, cstex_errorarray_name,
  63.         cstex_no_more_errors,
  64.         cstex_true_tex_background, cstex_background_beep
  65. cstex_error_index=-1
  66. cstex_no_more_errors=0
  67. cstex_true_tex_background=1  -- background compilation is: 0=window 1=icon
  68. cstex_background_beep=0      -- 0/1 nobeep/beep after background texing
  69. 'PostMe BuildCSTeXMenu'
  70.  
  71.  
  72. /*
  73. DEFLOAD 
  74.   -- 'a_togl_hilit S'
  75.   -- 'toggle_parse 1 epmkwds.tex'
  76. Syntax hilighting is now discussed in the manual pmCSTeX.INF. 
  77. Toggling the syntax on has been moved to your local config file, i.e. MyCNF.e
  78. Lines with  --PMTOGGLE  are no more needed, but for historical reasons 
  79.   they are still here
  80. */
  81.  
  82.  
  83. const 
  84.   -- CSTEX_CSTEX = 1 -- allow Czech (CSTeX distribution) related features
  85.   CSTEX_CSTEX = 0 -- disable Czech (CSTeX distribution) related features
  86.   -- enables/disables CSTOCS, CSTeX spell checker, dvi-out etc. 
  87.  
  88.   CSTEX_CS2CS = 1 -- use cs2cs program for Czech to Czech conversion
  89.   -- CSTEX_CS2CS = 0 -- use old DOS program
  90.  
  91.  
  92. const
  93.   cstex_texit_inf = 'Compile document by (La)TeX  (pm_command_cmd %format.cmd %N)'
  94.   cstex_preview_inf = 'Preview document by dvipm (using dvipm.cnf)'
  95.   cstex_paragraph_inf = 'Run LaTeX over current paragraph'
  96.   cstex_dvips_inf = 'Run dvi-out and dvips'
  97.   cstex_master_inf = 'Load Master file'
  98.   cstex_include_inf = 'Load the file under cursor'
  99.   cstex_refresh_inf = 'Refresh current file (reload from disk)'
  100.   cstex_save_all_inf = 'Save all files in the ring'
  101.   cstex_highlight_all_inf = 'Toggle syntax highlighting for the whole ring'
  102.   cstex_texit_background_inf = '(La)TeX the document on background'
  103.   cstex_next_error_inf = 'Locate next error in .log file (and open .log if necessary)'
  104.  
  105. DEFC cstex_actionlist
  106. universal ActionsList_FileID
  107.  
  108.  insertline 'cstex_texit'cstex_texit_inf'CSTeX',ActionsList_FileID.last+1,ActionsList_FileID
  109.  insertline 'cstex_preview'cstex_preview_inf'CSTeX',ActionsList_FileID.last+1,ActionsList_FileID
  110.  insertline 'cstex_paragraph'cstex_paragraph_inf'CSTeX',ActionsList_FileID.last+1,ActionsList_FileID
  111.  insertline 'cstex_dvips'cstex_dvips_inf'CSTeX',ActionsList_FileID.last+1,ActionsList_FileID
  112.  insertline 'cstex_master'cstex_master_inf'CSTeX',ActionsList_FileID.last+1,ActionsList_FileID
  113.  insertline 'cstex_include'cstex_include_inf'CSTeX',ActionsList_FileID.last+1,ActionsList_FileID
  114.  insertline 'cstex_refresh'cstex_refresh_inf'CSTeX',ActionsList_FileID.last+1,ActionsList_FileID
  115.  insertline 'cstex_save_all'cstex_save_all_inf'CSTeX',ActionsList_FileID.last+1,ActionsList_FileID
  116.  insertline 'cstex_texit_background'cstex_texit_background_inf'CSTeX',ActionsList_FileID.last+1,ActionsList_FileID
  117.  insertline 'cstex_next_error'cstex_next_error_inf'CSTeX',ActionsList_FileID.last+1,ActionsList_FileID
  118.  insertline 'cstex_highlight_all'cstex_highlight_all_inf'CSTeX',ActionsList_FileID.last+1,ActionsList_FileID
  119.  
  120.  
  121. const 
  122. COMPILE IF CSTEX_CSTEX=1
  123.   csindex='csIndex'
  124.   csbibtex='csBibTeX'
  125. COMPILE ELSE
  126.   csindex='Index'
  127.   csbibtex='BibTeX'
  128. COMPILE ENDIF
  129.  
  130. --------------------- KEYS DEFINITION ---------------------------------
  131.  
  132.  
  133. -- CTRL/3 \begin{} \end{} LaTeX environment
  134. def C_3 = 
  135. --x=winmessagebox('Choose environment','i=itemize' ,65535)
  136.   /* -- This comes from my Turbo Vision pmgraf program
  137.   s=',flush~left,~center,flush~right,eqnarray,~equation,array,~tabular,table,tabbing,'
  138.   s=s'e~numerate,~itemize,~description,displaymath,~picture,~figure,~verbatim,document'
  139.   */
  140. s=',array,center,description,displaymath,document,enumerate,eqnarray,equation,figure,flushleft,flushright,itemize,picture,tabbing,table,tabular,verbatim'
  141. s=listbox('environment',s,,20,22,17,25)  -- pos1,pos2,height,width
  142. -- s=entry_box('environment',s,'equation',30,30)
  143. if s='' then return; endif 
  144. if .col>1 then .line=.line+1; endif
  145. s=word(s,1)
  146. insertline '\begin{'s'}'
  147. insertline ''
  148. insertline '\end{'s'}'
  149. .line=.line-2
  150. .col=1
  151.  
  152.  
  153. -- CTRL/4 AMSLaTeX environments
  154. def C_4 = 
  155. s=',align,align*,aligntat,alignat*,bmatrix,cases,gather,gather*,matrix,multline,multline*,pmatrix,smallmatrix,split,subequations,Sb,Sp,vmatrix,Vmatrix,xalignat,xlignat*,xxalignat,xxlignat*'
  156. s=listbox('AMSLaTeX env.',s,,20,22,23,25)  -- pos1,pos2,height,width
  157. -- s=entry_box('environment',s,'equation',30,30)
  158. if s='' then return; endif 
  159. if .col>1 then .line=.line+1; endif
  160. s=word(s,1)
  161. insertline '\begin{'s'}'
  162. insertline ''
  163. insertline '\end{'s'}'
  164. .line=.line-2
  165. .col=1
  166.  
  167.  
  168. -- CTRL/5 LATeX font sizes
  169. def C_5 = 
  170. s=',tiny,scriptsize,footnotesize,smalle,normalsize,large,Large,LARGE,huge,Huge'
  171. s=listbox('font size',s,,20,22,10,25)  -- pos1,pos2,height,width
  172. if s='' then return; endif
  173. getline x; replaceline( insertstr('\'s,x,.col-1) )
  174. .col=.col+1+length(s)
  175.  
  176.  
  177.  
  178. -- Alt-G defines Greek keyboard. Keyboard layout according to Chi-writer
  179. def A_G = 
  180. keys pm_GreekKeys
  181.  
  182. DEFKEYS pm_OrigKeys
  183.  
  184. DEFKEYS pm_GreekKeys
  185. def 'a'-'t','x'-'z','G','D','E','S','L','X','P','S','F','O','J' = pm_TypeGreek()
  186.  
  187. DEFPROC pm_TypeGreek()
  188. universal czech_is
  189. a=lastkey(0)
  190. GreekAlphabet='\alpha\beta\chi\delta\epsilon\phi\gamma\eta\iota\psi\kappa\lambda\mu\nu\omega\pi\theta\rho\sigma\tau\\\upsilon\ksi\upsilon\zeta\'
  191. a=asc(a);
  192. if a>90 then i=a-96; else i=a-64; endif
  193. p=1; j=2
  194. while j<=i do p=pos('\',GreekAlphabet,p+1); j=j+1; endwhile
  195. i=pos('\',GreekAlphabet,p+1); 
  196. if a>90 
  197.   then s=substr(GreekAlphabet,p,i-p)
  198.   else s=upcase(substr(GreekAlphabet,p+1,1)); s='\'s''substr(GreekAlphabet,p+2,i-p-2)
  199.   endif
  200. getline x; replaceline( insertstr(s,x,.col-1) )
  201. .col=.col+length(s)
  202. -- load the keyset as before. If Czech.E is used, then czech_is holds the state
  203. if     czech_is=1 then keys czech_keys
  204. elseif